// 使用RTK构建store
import {configureStore, getDefaultMiddleware} from '@reduxjs/toolkit'
import stuApi from './studentApi'
import { stuReducer } from './stuSlice'

/**
 * 创建store
 * @param {object} option 配置对象
*/
const store = configureStore({
  reducer: {
    student: stuReducer,
    [stuApi.reducerPath]: stuApi.reducer
  },
  // RTKQ
  // 使得缓存生效
  middleware: getDefaultMiddleware => getDefaultMiddleware().concat(stuApi.middleware)
})
export default store